<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>可从外部关闭的下拉菜单</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">


  <!-- Latest compiled and minified CSS -->
  <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->


  <div id="app" class="container" v-cloak v-if="kill">
    <div class="row">
      <div class="main col-xs-6" v-clickoutside="handleClose">
        <button @click="show = !show">不支持ESC退出的下拉菜单</button>
        <div class="dropdown" style="position: absolute;" v-if="show">
          <p>下拉框的内容，点击外面区域可以关闭</p>
        </div>
      </div>

      <div class="main col-xs-6" v-clickoutside.esc="hanlelClose2">
        <button @click="show2 = !show2">支持ESC退出的下拉菜单</button>
        <div class="dropdown" style="position: absolute;" v-if="show2">
          <p>下拉框的内容，点击外面区域可以关闭</p>
        </div>
      </div>
      <!-- <button @click="removeVue">删除组件</button> -->
    </div>
  </div>

  <script src='https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js'></script>
  <script src="clickoutside.js"></script>
  <script src="index.js"></script>
</body>

</html>